home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
tex
/
td187src.lzh
/
PICTEX.I
< prev
next >
Wrap
Text File
|
1991-12-14
|
36KB
|
1,025 lines
IMPLEMENTATION MODULE Pictex ;
(*
Dieses Modul ist (C)'91 by Jens Pirnay
Entstanden am : 1990
Funktion : Übersetzung der Objekte in PiCTeX-Befehle
Änderungen : 18/11/90
Benutzte Ideen :
*)
FROM BezierCurve IMPORT ComputeRealBezier;
FROM Dialoge IMPORT BusyStart, BusyEnd;
FROM FileIO IMPORT Close, Rewrite, WriteLn;
FROM File IMPORT InsertFile;
FROM Types IMPORT TextPosTyp, DrawObjectTyp, ExtendedArraySize,
ObjectPtrTyp, ObjectSet;
IMPORT CommonData ;
IMPORT Diverses ;
IMPORT GetFile ;
IMPORT MathLib0 ;
IMPORT ObjectUtilities ;
IMPORT MagicStrings ;
IMPORT MagicSys ;
IMPORT Variablen ;
(**
IMPORT PDebug;
**)
(* Index 1 und 2 bezeichen immer den Referenzpunkt *)
(* Index 8 zumeist die Liniendicke, Index 9 die Textlänge so vorhanden *)
(* 0 | 3 | 4 | 5 | 6 | 7 | 8 | 9 *)
(* ---------------+--------+-------+---------------+-------+-------+------ *)
(* Picture | XExt | YExt |objekte|unitlen| | | *)
(* Text | | | | |AlignFl| |Textlen*)
(* Line | | | | | | | *)
(* Arrow | | | | | | | *)
(* Circle | Radius | | | | | | *)
(* Disk | Radius | | | | | | *)
(* Oval | Radius | Posit.| | | | | *)
(* Filledbox | XExt | XExt | | | | | *)
(* Ovalbox | XExt | YExt | | | | | *)
(* Framebox | XExt | YExt |Textpos|MBxFlag|AlignFl| |Textlen*)
(* Dashbox | XExt | Yext |Textpos| |AlignFl| |Textlen*)
(* Beziercurve | X2 | Y2 | X3 | Y3 |Points | | *)
(* Bezierellipse | X2 | Y2 | X3 | Y3 |Points | | *)
(* EpicSolidLine | Pts-1 | | | | | |MarkTL *)
(* EpicDottedLine | Pts-1 | | | | | | " *)
(* EpicDashedLine | Pts-1 | | | | | | " *)
(* EpicGrid | Xext | YExt |DeltaX |DeltaY | | | *)
CONST NUL = 0C ;
LF = 12C ;
CR = 15C ;
CNTR = 0;
LEFT = 1;
RGHT = 2;
TOP = 1;
BOT = 2;
BASE = 3;
VAR OutLine , Part , String : ARRAY [0..255] OF CHAR ;
Handle , i , j : INTEGER ;
Bool : BOOLEAN ;
LatexObs : BOOLEAN;
Object : ObjectPtrTyp ;
Width : INTEGER ; (* Liniendicke *)
(**********************************************************)
(**
PROCEDURE AppendChar(c : CHAR; VAR target : ARRAY OF CHAR);
VAR temp : ARRAY [0..1] OF CHAR;
BEGIN
temp[0] := c;
temp[1] := 0C;
MagicStrings.Append(temp, target);
END AppendChar;
**)
(**********************************************************)
PROCEDURE GetCoord(VAR Str : ARRAY OF CHAR;
X, Y : INTEGER;
dx, dy : INTEGER;
cx, cy : INTEGER);
(* cx : 0 = center , 1 = left , 2 = right *)
(* cy : 0 = center , 1 = topedge , 2 = baseedge , 3 = Baseline *)
VAR temp : ARRAY [0..127] OF CHAR;
number : ARRAY [0..19] OF CHAR;
BEGIN
temp := '} ';
IF (cx<>CNTR) OR (cy<>CNTR) THEN
(* AppendChar('[',temp);*)
MagicStrings.Append('[',temp);
(* IF cx=LEFT THEN AppendChar('l', temp); END;*)
IF cx=LEFT THEN MagicStrings.Append('l', temp); END;
(* IF cx=RGHT THEN AppendChar('r', temp); END;*)
IF cx=RGHT THEN MagicStrings.Append('r', temp); END;
(* IF cy=TOP THEN AppendChar('t', temp); END;*)
IF cy=TOP THEN MagicStrings.Append('t', temp); END;
(* IF cy=BOT THEN AppendChar('b', temp); END;*)
IF cy=BOT THEN MagicStrings.Append('b', temp); END;
(* IF cy=BASE THEN AppendChar('B', temp); END;*)
IF cy=BASE THEN MagicStrings.Append('B', temp); END;
MagicStrings.Append ('] ',temp);
END;
IF (dx<>0) OR (dy<>0) THEN
Variablen.SimpleValueToStr(dx, number);
(* AppendChar('<',temp);*)
MagicStrings.Append('<',temp);
MagicStrings.Append ( number, temp);
(* AppendChar(',',temp);*)
MagicStrings.Append(',',temp);
Variablen.SimpleValueToStr(dy, number);
MagicStrings.Append ( number, temp);
MagicStrings.Append ('> ',temp);
END;
MagicStrings.Append ('at ',temp);
Variablen.SimpleValueToStr(X, number);
MagicStrings.Append (number,temp);
(* AppendChar(' ',temp);*)
MagicStrings.Append(' ',temp);
Variablen.SimpleValueToStr(Y, number);
MagicStrings.Append (number,temp);
MagicStrings.Assign (temp, Str);
END GetCoord;
(**********************************************************)
PROCEDURE GetText (VAR TextStr : ARRAY OF CHAR;
Object : ObjectPtrTyp ) ;
VAR temp : ARRAY [0..255] OF CHAR;
insert : ARRAY [0..19] OF CHAR;
i, j, len : INTEGER;
lines : BOOLEAN;
BEGIN
temp := '';
len := Object^.Code[9];
lines := FALSE;
IF len>0 THEN
i := 0;
j := 0;
WHILE (i<len) DO
IF (i<len-1) AND (Object^.CPtr^ [ i ] = '\') AND
(Object^.CPtr^ [ i+1 ] = '\') THEN
lines := TRUE;
INC(i, 1);
temp[j] := '\';
temp[j+1] := 'c';
temp[j+2] := 'r';
temp[j+3] := ' ';
INC(j, 3);
ELSE
temp[j] := Object^.CPtr^ [ i ];
END;
INC(i, 1);
INC(j, 1);
temp[j] := 0C;
END;
IF lines THEN
CASE Object^.Code[7] OF
1 : insert := '\lines [l] {';|
2 : insert := '\lines [r] {';|
ELSE
insert := '\lines{';
END;
MagicStrings.Insert(insert, temp, 0);
MagicStrings.Append ( '\cr}', temp);
END;
END;
MagicStrings.Assign (temp, TextStr);
END GetText;
(**********************************************************)
PROCEDURE FromTo(VAR txt : ARRAY OF CHAR;
x1, y1, x2, y2 : INTEGER);
VAR temp : ARRAY [0..99] OF CHAR;
number : ARRAY [0..19] OF CHAR;
BEGIN
temp := 'from ';
Variablen.SimpleValueToStr(x1, number);
MagicStrings.Append ( number, temp);
Variablen.SimpleValueToStr(y1, number);
(* AppendChar(' ', temp);*)
MagicStrings.Append(' ', temp);
MagicStrings.Append ( number, temp);
Variablen.SimpleValueToStr(x2, number);
MagicStrings.Append ( ' to ', temp);
MagicStrings.Append ( number, temp);
Variablen.SimpleValueToStr(y2, number);
(* AppendChar(' ', temp);*)
MagicStrings.Append(' ', temp);
MagicStrings.Append ( number, temp);
MagicStrings.Assign (temp , txt);
END FromTo;
(**********************************************************)
PROCEDURE FromTo10(VAR txt : ARRAY OF CHAR;
x1, y1, x2, y2 : MagicSys.lINTEGER);
VAR temp : ARRAY [0..99] OF CHAR;
number : ARRAY [0..19] OF CHAR;
BEGIN
temp := 'from ';
Variablen.SimpleValue10ToStr(x1, number);
MagicStrings.Append ( number, temp);
Variablen.SimpleValue10ToStr(y1, number);
(* AppendChar(' ', temp);*)
MagicStrings.Append(' ', temp);
MagicStrings.Append ( number, temp);
Variablen.SimpleValue10ToStr(x2, number);
MagicStrings.Append ( ' to ', temp);
MagicStrings.Append ( number, temp);
Variablen.SimpleValue10ToStr(y2, number);
(* AppendChar(' ', temp);*)
MagicStrings.Append(' ', temp);
MagicStrings.Append ( number, temp);
MagicStrings.Assign (temp , txt);
END FromTo10;
(**********************************************************)
PROCEDURE Rule(x1, y1, x2, y2 : INTEGER);
VAR number : ARRAY [0..99] OF CHAR;
BEGIN
OutLine := '\putrule ';
FromTo(number, x1, y1, x2, y2);
MagicStrings.Append ( number, OutLine);
WriteLn(Handle, OutLine);
END Rule;
(**********************************************************)
PROCEDURE DoubleArrow(x1, y1, x2, y2 : INTEGER);
VAR X1, Y1, X2, Y2, xtmp, ytmp : MagicSys.lINTEGER;
numb